home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Information
/
THINK C Digest
/
1991
/
91-03
< prev
next >
Wrap
Text File
|
1995-12-31
|
79KB
|
2,102 lines
Path: ucivax!gateway
From: dmac@eagle.mit.edu ("David S. McCormick")
Subject: Stack smashing the heap in TCL
Message-ID: <9103022228.AA00797@EAGLE.MIT.EDU>
Newsgroups: fa.think-c
Lines: 44
Date: 2 Mar 91 22:32:07 GMT
I am using a dialog subclass of window which accesses STR# and TEXT/styl
resources to create a help window. I am using a subclass of StaticText
which handles TEXT/styl resources in a ScrollPane. The STR# is read in
just fine.
For the Dialog
itsGopher = this;
so that I can intercept KeyDown's to give the list pane KeyDowns and
subsequently change to a new TEXT/styl resource.
I load these resources depending what item in a scrolling list are
clicked on. I load them with
void CMyHelpDialog::DoListClick ()
{
CharsHandle theAboutText;
StScrpHandle theAboutStyle;
...
theTextH = GetResource( 'TEXT', theID);
theStyleH = GetResource( 'styl', theID);
...
/* put the TEXT/styl in the Panorama */
...
ReleaseResource ((Handle) theTextH);
ReleaseResource ((Handle) theStyleH);
...
}
Anyhow, I intercept the keydowns fine and switch the position in the
list, then load a new TEXT/styl resource to correspond to this change.
After a couple of keydowns, the Mac freezes and when I poke around in
TMON I get the infamous Deep Shit Errors 25 and 28 which means that the
Stack has grown over the Heap and smashed the Heap.
THIS PROBLEM ONLY OCCURS WHEN I BUILD THE APPLICATION; IT WORKS FINE
WHEN IN THE DEBUGGER.
Can anyone give me any clues as to why the stack is suddenly getting so
big?
Many thanks.
Cheers,
David S. McCormick
MIT-EAPS Geology
dmac@eagle.mit.edu
Path: ucivax!gateway
From: dmac@eagle.mit.edu ("David S. McCormick")
Subject: Stack smashing the heap in TCL
Message-ID: <9103022233.AA00824@EAGLE.MIT.EDU>
Newsgroups: fa.think-c
Lines: 44
Date: 2 Mar 91 22:37:22 GMT
I am using a dialog subclass of window which accesses STR# and TEXT/styl
resources to create a help window. I am using a subclass of StaticText
which handles TEXT/styl resources in a ScrollPane. The STR# is read in
just fine.
For the Dialog
itsGopher = this;
so that I can intercept KeyDown's to give the list pane KeyDowns and
subsequently change to a new TEXT/styl resource.
I load these resources depending what item in a scrolling list are
clicked on. I load them with
void CMyHelpDialog::DoListClick ()
{
CharsHandle theAboutText;
StScrpHandle theAboutStyle;
...
theTextH = GetResource( 'TEXT', theID);
theStyleH = GetResource( 'styl', theID);
...
/* put the TEXT/styl in the Panorama */
...
ReleaseResource ((Handle) theTextH);
ReleaseResource ((Handle) theStyleH);
...
}
Anyhow, I intercept the keydowns fine and switch the position in the
list, then load a new TEXT/styl resource to correspond to this change.
After a couple of keydowns, the Mac freezes and when I poke around in
TMON I get the infamous Deep Shit Errors 25 and 28 which means that the
Stack has grown over the Heap and smashed the Heap.
THIS PROBLEM ONLY OCCURS WHEN I BUILD THE APPLICATION; IT WORKS FINE
WHEN IN THE DEBUGGER.
Can anyone give me any clues as to why the stack is suddenly getting so
big?
Many thanks.
Cheers,
David S. McCormick
MIT-EAPS Geology
dmac@eagle.mit.edu
Path: ucivax!gateway
From: ehorvath@attmail.COM
Subject: Re: class declarations
Original-From: attmail!ehorvath (Ned Horvath )
Lines: 82
Date: 4 Mar 91 01:52:40 GMT
Phone: +1 908 671 7100
Message-ID: <9103031750.aa14781@ICS.UCI.EDU>
In-Reply-To: your message <internet0590007030> of Wed Feb 27 21:26:10 GMT 1991
>To: internet!ics.uci.edu!think-c
Content-Type: text
Content-Length: 3338
Newsgroups: fa.think-c
Message-Version: 2
EMail-Version: 2
UA-Message-ID: <MAC-1.3.2-618034-ehorvath-254>
UA-Content-ID: <MAC-1.3.2-618034-ehorvath-254>
MTS-Message-ID: <ehorvath0630027101>
Garth Dickie writes,
> I am writing a class library for TC4; I want to experiment with some stuff
> which doesn't fit into the TCL. This question has to do with the way I
> create objects from resource templates.
>The idea is to correlate an integer with every class which may be
> instantiated from a template. Then that integer is translated at runtime
> into a void*, which can be passed to new to get an object of the appropriate
> type. What I *don't* want to do is a switch with one line per class, or
> similar kludery.
...
If Garth's the only person interested in this kind of elegant hack, please
forgive posting to the list. But I suspect there's more than one person out
there who's interested...
The following file compiles clean for me (I copied it directly from the ThC
source window, so I KNOW it's clean):
------- Cut here ----------
#define ctabEntry(name,restype) { #name, restype, name }
typedef struct classTab {
char * className;
ResType classResType;
void * classSpec;
} classTab;
#include <CPanorama.h>
#include <CPane.h>
#include <CBureaucrat.h>
classTab myTab[] = {
ctabEntry (CPane, 'Pane'),
ctabEntry (CBureaucrat, 'Buro'),
ctabEntry (CPanorama, 'Pano'),
{0,0,0}
};
------- End Cut ------------
A bit of explanation. The ctabEntry macro exploits an ANSI-ism, namely
#param becomes "paramvalue"
when the macro is expanded. This lets you type each class name once, and the
string constant is guaranteed to match the type name. This is a nice
typecheck: to see that ThC will catch an error, try adding
ctabEntry (CBogus, 'hah!'),
to the myTab definition.
Anyway: each classTab entry contains the name of the class as a string
constant; the resource type you want to associate with the class; and the
void* that bless(obj,classtype) wants for its second argument.
An aside: please excuse the use of CBureaucrat; that's an abstract class that
you'll never instantiate, let alone save as a resource, but you could if you
wanted to...
This table now admits of lookup based on any of several criteria; I'm tempted
to expand it into a full-blown class definition myself. Some of the
operations you might perform with a table like this are
- look up the resource type associated with a given class by name.
- look up resource type given class by void*.
- look up resource type given an instance of the class.
- look up class type given a resource type.
- look up class type given a resource.
- a replacement for LoadResource, but returning a blessed object.
- a replacement for CreateResource, but taking an object as argument.
One of the objections Garth raises to this approach is that the classTab has
to be recompiled whenever any of the class interface headers changes. That's
perfectly true, but personally, I couldn't care less: it's a small price to
pay, and ThC will take care of it for me. Notice that the rest of what he was
after -- only one source file to maintain, and the linker does most of the
work -- are satisfied by this approach. You still need to write the lookup
procedures.
Is that the kind of thing you had in mind, or have I missed your intent
entirely? Anyway it was fun to think about, so thanks for the stimulation...
=Ned Horvath=
ehorvath@attmail.com
ehorvath@applelink.apple.com
Path: ucivax!gateway
From: dmac@eagle.mit.edu ("David S. McCormick")
Subject: Re: Stack smashing the heap in TCL
Message-ID: <9103041333.AA05483@EAGLE.MIT.EDU>
Newsgroups: fa.think-c
Lines: 9
Date: 4 Mar 91 13:35:16 GMT
As ephaim@think.com pointed out, I did not indicate which machine I was
running on when all the excitement occurred. I am using an SE/30 running
sys 6.0.7 with 8 mb RAM under Multifinder with the default application
memory size of 384k.
Thanks,
David S. McCormick
MIT-EAPS Geology
dmac@eagle.mit.edu
Path: ucivax!gateway
From: dmac@eagle.mit.edu ("David S. McCormick")
Subject: Where to intercept clicks to allow different panes to communicate within same window?
Message-ID: <9103041954.AA12274@EAGLE.MIT.EDU>
Newsgroups: fa.think-c
Lines: 18
Date: 4 Mar 91 19:57:03 GMT
I have a window which contains several panes which need to communicate.
I have a scrolling list pane and a static text in a scroll pane to
display some TEXT resources. When the list is clicked on, a particular
TEXT resource is loaded into theTextPane. I have gotten this to work by
having a list method SetCmdClick() which is the same that for CButton,
so that when the DoClick() method is invoked for the list, itsSupervisor
gets a DoCommand() message afterward. Is there a more
politically-correct TCL way to do this? It's easy to override the
DoKeyDown() method for a Document or Director to dispatch KeyDown's, but
the document can's normally dispatch clicks. Should I declare a subclass
of Window to allow it to dispatch clicks?
Any help appreciated.
Cheers,
David S. McCormick
MIT-EAPS Geology
dmac@eagle.mit.edu
Path: ucivax!gateway
From: jbr@cblph.att.COM
Subject: Sharing Classes Between Projects
Message-ID: <9103050613.aa04479@ICS.UCI.EDU>
Newsgroups: fa.think-c
Original-From: j.a.brownlee
Lines: 32
Date: 5 Mar 91 14:16:07 GMT
I have some classes that I would like to share between several projects. The
classes aren't generally useful for any type of project -- they are only useful
across a suite of applications I am developing.
Sharing the .c files is easy, but I am having trouble coming up with a good
way to share the .h files. I would like a method that does not require a
complete re-work if I move the entire directory structure to a new location.
Here is what I have thought of:
. Put the stuff in the THINK C tree. I would like to avoid this if
possible, but this is probably my fall back solution.
. Use some sort of relative pathname in the #include statements, like
using "../file.h" under UNIX. Is there a way to do this?
. Use a #define in each project to define the desired include directory,
then use statements like:
#include MY_INCLUDE_DIR ## "file.h"
(does this even work?) This is crummy because if I move the include
directory, I have to edit a file in every project.
I'm sure someone out there has run into this problem before, so I am interested
in hearing any solutions you have tried. E-mail if you like, but I think that
this topic would interest many list subscribers.
- _ Joe Brownlee, Analysts International Corp. @ AT&T Network Systems
/_\ @ / ` 471 E Broad St, Suite 1610, Columbus, Ohio 43215 (614) 860-7461
/ \ | \_, E-mail: jbr@cblph.att.com Who pays attention to what _I_ say?
"Scotty, we need warp drive in 3 minutes or we're all dead!" --- James T. Kirk
Path: ucivax!gateway
From: MCGUFFEY@muvms3.mu.wvnet.edu (Michael McGuffey)
Subject: anyone know where i can find Spinside Macintosh?
Message-ID: <66EDA173A0202B3B@WVNVMS.WVNET.EDU>
Newsgroups: fa.think-c
X-VMS-To: IN%"think-c@ics.uci.edu"
Lines: 20
Date: 5 Mar 91 16:40:22 GMT
X-Envelope-to: think-c@ics.uci.edu
I've been looking around for the electronic version of the _Inside Macintosh_
series. It's not on apple.com. Judging from the ls-lR on ftp.apple.com,
it's there, but not accessible. I looked on CompuServe but cannot find it.
I don't really have access to a CD-Rom at this time or I would subscribe to
D E V E L O P.
Anyone have any suggestions?
Also, is _Spinside Macintosh_ a replacement for the 5 volume set or is
that set still recommended?
-----------------------------------------------------------------------------
Michael McGuffey, Director BITNET: mcguffey@marshall
Office of Institutional Research Internet: mcguffey@marshall.wvnet.edu
Marshall University Phone: 304/696-3212
Huntington, WV 25755 FAX: 304/696-3601
-----------------------------------------------------------------------------
Path: ucivax!gateway
From: bin@primate.wisc.edu (Brain in Neutral)
Subject: Re: Sharing Classes Between Projects
Message-ID: <9103051637.AA03076@rhesus.primate.wisc.edu>
Newsgroups: fa.think-c
Lines: 53
Date: 5 Mar 91 16:40:51 GMT
>I have some classes that I would like to share between several projects. The
>classes aren't generally useful for any type of project -- they are only useful
>across a suite of applications I am developing.
>Sharing the .c files is easy, but I am having trouble coming up with a good
>way to share the .h files. I would like a method that does not require a
>complete re-work if I move the entire directory structure to a new location.
Yes, indeed, so would I. The method that I am aware of (put the .h files
in current or subfolder) is unhelpful. It leads to duplication of files
in multiple project folders (a bad idea) or ugly pathname dependencies.
The latter is also a problem for .c files included in projects if you happen
to move the project somewhere else. Suddenly you have to remove and re-add
some files.
>Here is what I have thought of:
> . Put the stuff in the THINK C tree. I would like to avoid this if
> possible, but this is probably my fall back solution.
This is what I do for header files. I have a "local #includes" folder
as a counterpart to "mac #includes" in the THINK C folder. At least that
way it's marked as not part of the standard distribution.
But I wish there were some sort of project-specific configuration one
could use to duplicate the UNIX cc -I option...
> . Use some sort of relative pathname in the #include statements, like
> using "../file.h" under UNIX. Is there a way to do this?
Breaks if you move your project folder somewhere else?
> . Use a #define in each project to define the desired include directory,
> then use statements like:
> #include MY_INCLUDE_DIR ## "file.h"
> (does this even work?) This is crummy because if I move the include
> directory, I have to edit a file in every project.
Perhaps if there is a project-specific header file that's #included in
every project file, you could put that line in it. At least that way,
when you move the project, you only have to edit one line.
>I'm sure someone out there has run into this problem before, so I am interested
>in hearing any solutions you have tried. E-mail if you like, but I think that
>this topic would interest many list subscribers.
It would certainly interest me.
Paul DuBois
dubois@primate.wisc.edu
Path: ucivax!gateway
From: rsfinn@quark.lcs.mit.edu ("Russell S. Finn")
Subject: Re: Sharing Classes Between Projects
Message-ID: <9103052031.AA02200@quark.LCS.MIT.EDU>
Newsgroups: fa.think-c
Lines: 65
Date: 5 Mar 91 20:34:30 GMT
Paul DuBois writes (quoting Joe Brownlee initially):
> >I have some classes that I would like to share between several projects. The
> >classes aren't generally useful for any type of project -- they are only useful
> >across a suite of applications I am developing.
>
> >Sharing the .c files is easy, but I am having trouble coming up with a good
> >way to share the .h files. I would like a method that does not require a
> >complete re-work if I move the entire directory structure to a new location.
>
> Yes, indeed, so would I. The method that I am aware of (put the .h files
> in current or subfolder) is unhelpful. It leads to duplication of files
> in multiple project folders (a bad idea) or ugly pathname dependencies.
> The latter is also a problem for .c files included in projects if you happen
> to move the project somewhere else. Suddenly you have to remove and re-add
> some files.
I'm not sure I understand the problem. If you're working on a related
group of programs, then it doesn't seem unreasonable to place all of
the project files in one folder. Why isn't the following scheme
satisfactory (indentation represents nesting of folders)?
* Suite Folder
* App1.proj
* App1.proj.rsrc
* App1 Source Folder
* App1-main.c
* App1-sub1.c
* ...
* App1 Include Folder
* App1-defs.h
* ...
* App2.proj
* App2.proj.rsrc
* App2 Source Folder
* App2-main.c
* App2-sub2.c
* ...
* App2 Include Folder
* App2-defs.h
* ...
* Common Source Folder
* common-subs.c
* ...
* Common Include Folder
* common-defs.h
* ...
If there are naming conflicts between application-specific files
(e.g., two "main.c" files), the "App1" folders could be placed in
a project-specific folder called "(App1.proj)", etc.
You need to be careful when creating files, to make sure they go into
the proper folders (a utility like Super Boomerang would be a great
help here), but having done that, you can open your source and include
files directly from the project window, so navigating the hierarchy
shouldn't be a problem. Since the project files themselves are at the
top level of this hierarchy, all subfolders will be searched for
include files (except, of course, those named with parentheses), so
there shouldn't be any trouble finding them.
Now I've just done this off the top of my head, so maybe I've
overlooked something, but is that what you're looking for?
-- Russell Finn
rsfinn@lcs.mit.edu
Path: ucivax!gateway
From: julian@riacs.edu
Subject: Re: Sharing Classes Between Projects
Message-ID: <657.668225766@miranda.riacs.edu>
Newsgroups: fa.think-c
Lines: 4
Date: 6 Mar 91 02:19:40 GMT
Seems to me that using THINK C's parenthesis rule would help here. All
projects would go in a main folder. Each project's specific files
would go in its parenthesized subfolder. The common files would go in
non-parenthesized folders.
Path: ucivax!gateway
From: bin@primate.wisc.edu (Brain in Neutral)
Subject: Re: Sharing Classes Between Projects
Message-ID: <9103060704.AA08978@rhesus.primate.wisc.edu>
Newsgroups: fa.think-c
Lines: 21
Date: 6 Mar 91 07:07:45 GMT
>I'm not sure I understand the problem. If you're working on a related
>group of programs, then it doesn't seem unreasonable to place all of
>the project files in one folder. Why isn't the following scheme
>satisfactory (indentation represents nesting of folders)?
>* Suite Folder
>* App1.proj
>* App1.proj.rsrc
>* App1 Source Folder
> etc.
If they're related, yes. But what if the files to which you want
to refer are general enough or of sufficient importance that you want
to use them in *all* your projects, related or not?
E.g., for commonly-included header files, why should I have to care
at all where I put my project, and its folder/subfolders?
Paul DuBois
dubois@primate.wisc.edu
Path: ucivax!gateway
From: minow@bolt.enet.dec.COM ("Martin Minow, ML3-5/U26 06-Mar-1991 1010")
Subject: re: sharing classes
Message-ID: <9103061517.AA25936@decpa.pa.dec.com>
Newsgroups: fa.think-c
Lines: 15
Date: 6 Mar 91 15:21:58 GMT
Of course, what we have here is another instance of multiple-inheritance.
I just duplicate the files, but, hey, I'm lazy. I think that System 7's
"alias" capability would let you keep one central source code repository
that is visible in multiple folders. (This assumes, of course, that
the Think compiler handles aliased files correctly, but I don't think
this is a real problem.)
Now, if only I could put my resource source file in the project so
it gets built automatically.
And, if only that resource source was in Rez format so constants were
entered once only.
Martin.
Path: ucivax!gateway
From: rsfinn@quark.lcs.mit.edu ("Russell S. Finn")
Subject: Re: Sharing Classes Between Projects
Message-ID: <9103061943.AA02959@quark.LCS.MIT.EDU>
Newsgroups: fa.think-c
Lines: 18
Date: 6 Mar 91 19:46:34 GMT
> If they're related, yes. But what if the files to which you want
> to refer are general enough or of sufficient importance that you want
> to use them in *all* your projects, related or not?
OK, in that case, I agree it's best to just put them in a folder in
your THINK C folder. I thought the original poster said he was
working on a group of related projects, and had files common to those
projects (but not necessarily applicable outside the group), so I made
my suggestion.
As Martin Minow points out, the use of aliases in System 7 may help
the situation out as well. (In fact, I can't help thinking that it's
been over a year and a half since THINK C 4.0 came out (hi, Michael),
and while I don't want to start any rumors, wouldn't a System-7-studly
version of THINK C be something to look forward to?)
-- Russ
Path: ucivax!gateway
From: jbr@cblph.att.COM
Subject: Re: Sharing Classes Between Projects
Message-ID: <9103070433.aa26420@ICS.UCI.EDU>
Newsgroups: fa.think-c
Original-From: j.a.brownlee
Lines: 10
Date: 7 Mar 91 12:34:48 GMT
Thanks one and all for your comments. I am going to use the "sub-folder"
method, which seems to meet my needs. However, as one poster pointed out,
THINK C really needs a dialog something like "cc -I" to specify include
directories. And while you're at it, how about a "cc -D"-like option to
define global pre-processor symbols, too?
- _ Joe Brownlee, Analysts International Corp. @ AT&T Network Systems
/_\ @ / ` 471 E Broad St, Suite 1610, Columbus, Ohio 43215 (614) 860-7461
/ \ | \_, E-mail: jbr@cblph.att.com Who pays attention to what _I_ say?
"Scotty, we need warp drive in 3 minutes or we're all dead!" --- James T. Kirk
Path: ucivax!gateway
From: dickie@math.wisc.edu (Garth Dickie)
Subject: Re: Rez (Was Re: Sharing classes)
Message-ID: <9103061412.AA00419@macduffe>
Newsgroups: fa.think-c
Lines: 35
Date: 7 Mar 91 14:35:22 GMT
"Martin Minow" <minow@bolt.enet.dec.COM> writes...
>And, if only that resource source was in Rez format so constants were
>entered once only.
This one, at least, does have a solution. SARez/SADerez is in pub/dts/nerdtools
at ftp.apple.com (not apple.com). There is no documentation, or header files.
However, somewhere (I forget at the moment) the headers for MPW C, Pascal, and
(bingo!) Rez have been placed for ftp. I think they are on apple.com. The SA
versions run as standalone applications, and come up into the standard commando
interface. When you have set up a command line, you can save it as a SARez
document; thereafter, opening the document launches Rez on that command line,
*without* bringing up the commando interface. It is not quite as convenient
as having the compiler launch for you from a make, but it is quite a bit better
than using RMaker. Among other things, you can define your own types...
There is no documentation on the Rez format available for ftp, that I know of,
but there are several sources of information:
-- the .r headers from MPW
-- the .r header from the installer 3.0 documentation is more complicated
-- run SADerez on large resource files and look at the ouput ;-)
-- run SADerez on the 'STR#' resources in SARez, and read! This gives you all
of the possible error messages and tokens.
If you design your headers correctly, you can use them for both C and Rez.
essentially, anything but a #define needs to be bracketed by #ifndef Rez,
#endif directives. (Rez is defined when Rez is running, Derez when Derez is
running, apparently).
Among other things, Rez will compile multiple source files into a single
resource file, process `include` (not #include) statements to include actual
resources from other files, and optionally merge compiled resources into the
destination, rather than creating the destination.
Sorry if this is all well known,
-- garth
Path: ucivax!gateway
From: paco@neuromancer.sps.mot.COM (Paco Xander Nathan)
Subject: Sys 6.0.7 SndManager
Message-ID: <9103082046.AA15602@neuromancer>
Newsgroups: fa.think-c
Lines: 21
Date: 8 Mar 91 21:13:47 GMT
So now that system 6.0.7 has the new Sound Manager, does anybody have trap
addresses for the new routines, eg. SndRecord() ???
I've d/l the interim "Sound Manager/Glue" off the DTS section of AppleLink (it's only in an
AppleLink format so there's little use in posting it). It has the interim Inside Macintosh
rewrite for SndMgr, but it doesn't include trap addresses.
We've been doing some sound work here, and would like to call SndRecord() from ThC.
Anybody seen another SndMgr interface?
Thanks -
paco
----
Internet: paco@neuromancer.sps.mot.com
Cyberspace Development
Motorola, Microprocessors
Austin, Texas, USA
(c)1991, PXN. Subject to Public Law 99-508. B*B!
Path: ucivax!gateway
From: jim@fpr.COM ("James E. O'Dell")
Subject: Floating point stangeness
Message-ID: <9103090248.AA18221@uu.psi.com>
Newsgroups: fa.think-c
Reply-To: "James E. O'Dell" <jim@fpr.COM>
Organization: Fort Pond Research
Lines: 36
Date: 9 Mar 91 02:54:34 GMT
I am having trouble with the following short C program...
void main()
{
double fl;
while (TRUE)
{
scanf("%lf", &fl);
printf("%lf\n", fl);
}
}
Here's the problem.
Type in 1.0
All is fine I get back 1.0
Type in 1.0e-40
All is fine I get back zero
Type in 1.0e-4000
All is fine get back zero
Now type in 1.0e-50000
I get back INF.
This seems like a bug in either SANE or the way THink C is using it.
I would like to get back zero for 1.0e-50000 also.
Do I have to make a pre-pass on all of my input to accomplish that?
If not how do I get it?
Thanks,
Jim O'Dell
Path: ucivax!gateway
From: bose@u.washington.edu (Rob Olsen)
Subject: Mailing list
Message-ID: <9103090844.AA15067@milton.u.washington.edu>
Newsgroups: fa.think-c
Lines: 1
Date: 9 Mar 91 13:22:57 GMT
Could you take my name off the mailing list? Thank you.
Path: ucivax!gateway
From: russotto@eng.umd.edu ("Matthew T. Russotto")
Subject: Re: Floating point stangeness
Message-ID: <9103110052.AA07194@bagend.eng.umd.edu>
Newsgroups: fa.think-c
Lines: 3
Date: 13 Mar 91 03:57:49 GMT
(-50000) is not in the range of integers, which is probably your limit. You
might want to change the libraries to use longwords instead, though that
merely extends the limit
Path: ucivax!gateway
From: soudan@iitmax.iit.edu (Bassel Soudan)
Subject: (none)
Message-ID: <9103112200.AA04041@iitmax.iit.edu>
Newsgroups: fa.think-c
Lines: 57
Date: 13 Mar 91 04:28:22 GMT
Hello fellow mail list patrons,
I have a problem that I am trying to solve and I need your help.
The problem has to do with multiple inheritance and goes like this:
I created a CComponent class to model a hardware component. Each
component is made up of several elements (Panes, Buttons, StaticText etc.).
The elements for the components are grouped together in a List called
itsElements. When my component receives a Draw or Move message, I want to
pass that along to all the elements that make up this component. Here is what I
am doing now :
In my CComponent::Draw() method I call
DoForEach->itsElements(DrawElem);
In DrawElem (CObject *obj) I try to do the following :
obj->Draw(); All the elements that make up the
components have a Draw message defined.
When I try to compile this program, I get the famous "Draw is not part
of the struct or union" or something similar to that. I get this because CObject
does not have a Draw method (and it shouldn't).
What I want to do is create a co-parent class for all the objects that
will be elements in my components, so that I can cast obj into that and solve
the problem. The elements that I am using are all subclasses that I derived
from the original classes. (for example I derived a CField class as a sub-class
of CPane).
I created a sub-class of CObject and made all my element classes
sub-classes of that class. The only problem is that my element classes no
longer exhibit the behavior of their original parents. (i.e. my CField which
should be working like a CPane is no longer able to perform any of the things
that a CPane can).
I asked this quetion somewhere else, and somebody suggested that I
create a subclass of CObject (call it Element for now) and then customize
it by pointing to instances of a CPane or a CButtonor or whatever. The only
problem is that my customized instance of CElement will not inherit all the
behavior of the parent class (the one whose instance I am pointing to).
The whole problem is that I need to cast the entries in the itsElements
list to be able to pass them the Draw message that I got. If anyone knows a way
to bypass this casting requirement, that might solve my problem.
I am sorry if this has been long and confusing but this is the only
way I could describe the problem. If you can be of any assistance I would be
eternally gratefull.
Sincerely yours,
Bassel Soudan
soudan@iitmax.iit.edu
Path: ucivax!gateway
From: Mark.Alldritt@vancouver.osiware.bc.ca (Mark Alldritt)
Subject: TCL app's stop Moire cdev
Message-ID: <910312856*Mark.Alldritt@Vancouver.osiware.bc.ca>
Newsgroups: fa.think-c
Lines: 9
Date: 13 Mar 91 04:42:41 GMT
I have noticed that when i'm debugging an application which is based on
the THINK-C Class Library the Moire cdev stops. By stops I mean that the
clock stops, and the screen saver will not start (even when I put the
mouse in the sleep region). Has anyone else run into this problem, and
is there a fix I can make?
Thanks in advance,
-Mark
Path: ucivax!gateway
From: ehorvath@attmail.COM
Subject: Re: TCL app's stop Moire cdev
Original-From: attmail!ehorvath (Ned Horvath )
Lines: 11
Date: 13 Mar 91 17:30:07 GMT
Phone: +1 908 671 7100
Message-ID: <9103130927.aa28871@ICS.UCI.EDU>
In-Reply-To: your message <internet0720540070> of Wed Mar 13 04:42:41 GMT 1991
>To: internet!ics.uci.edu!think-c
Content-Type: text
Content-Length: 384
Newsgroups: fa.think-c
Message-Version: 2
EMail-Version: 2
UA-Message-ID: <MAC-1.3.2-618034-ehorvath-299>
UA-Content-ID: <MAC-1.3.2-618034-ehorvath-299>
MTS-Message-ID: <ehorvath0721614060>
>I have noticed that when i'm debugging an application which is based on
>the THINK-C Class Library the Moire cdev stops...
In your CApplication initialization, set gSleepTime to something less than
infinity (the default).
Greg Dow considers this a Moire (and Pyro, and...) bug, and I agree with him,
but we have to live in an imperfect world...
=Ned Horvath=
ehorvath@attmail.com
Path: ucivax!gateway
From: ehorvath@attmail.COM
Subject: Recursive drawing
Original-From: attmail!ehorvath (Ned Horvath )
Lines: 39
Date: 13 Mar 91 17:30:43 GMT
Phone: +1 908 671 7100
Message-ID: <9103130928.aa28929@ICS.UCI.EDU>
In-Reply-To: your message <internet0720540080> of Wed Mar 13 04:28:22 GMT 1991
>To: internet!ics.uci.edu!think-c
Content-Type: text
Content-Length: 1402
Newsgroups: fa.think-c
Message-Version: 2
EMail-Version: 2
UA-Message-ID: <MAC-1.3.2-618034-ehorvath-300>
UA-Content-ID: <MAC-1.3.2-618034-ehorvath-300>
MTS-Message-ID: <ehorvath0721614120>
soudan@iitmax.iit.edu (Bassel Soudan) writes:
> In my CComponent::Draw() method I call
> DoForEach->itsElements(DrawElem);
> In DrawElem (CObject *obj) I try to do the following :
> obj->Draw(); All the elements that make up the
components have a Draw message
defined.
> When I try to compile this program, I get the famous "Draw is not
>part of the struct or union" or something similar to that. I get this because
>CObject does not have a Draw method (and it shouldn't).
Correct. But it does sound as though each type of element could be a subclass
of CPane. Then your DrawElem should be declared
DrawElem (CPane *obj)
...obj->Draw();
You can ensure safety by creating a specialization of CList that only accepts
CPanes as elements, and using that as your list-of-elements class.
This fails if there are components that have no visible aspect (a weird,
anti-WYSIWYG notion!), i.e. that don't derive from CPane. Even there, you can
fix things up in your DrawElem routine:
DrawElem (CObject *obj)
{
if (member (obj, CPane)) { /* if it's drawable... */
((CPane*)obj)->Draw(); /* ...draw it */
}
}
Hope that helps!
=Ned Horvath=
ehorvath@attmail.com
Path: ucivax!gateway
From: minow@ranger.enet.dec.COM (Martin Minow 13-Mar-1991 1438)
Subject: re: recursive drawing
Message-ID: <9103131939.AA24122@enet-gw.pa.dec.com>
Newsgroups: fa.think-c
Lines: 21
Date: 13 Mar 91 19:43:17 GMT
soudan@iitmax.iit.edu (Bassel Soudan) writes:
> In my CComponent::Draw() method I call
> DoForEach->itsElements(DrawElem);
> In DrawElem (CObject *obj) I try to do the following :
> obj->Draw(); All the elements that make up the
components have a Draw message
defined.
I would approach this problem by something like the following:
1. create a CDirector sub-class which "owns" both the data and its
visual representation.
2. create instance variables with the data
3. create instance variables with CPane (subclasses) to draw the data in.
Now, as long as the CPane's are enclosed by a CPane that is drawn, they
will be drawn automatically. Each CPane Draw() method would understand
how to draw its data element. Take a look at CClipboard for one such
example. Note that the TCL does the DoForEach (itsSubviews) for you.
Martin
minow@ranger.enet.dec.com (new address, please update the mail database)
Path: ucivax!gateway
From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
Subject: TCL app's stop Moire cdev
Message-ID: <9103132017.AA01170@chaos.cs.brandeis.edu>
In-Reply-To: Mark Alldritt's message of 13 Mar 91 04:42:41 GMT <910312856*Mark.Alldritt@Vancouver.osiware.bc.ca>
Newsgroups: fa.think-c
Lines: 22
Date: 13 Mar 91 20:26:53 GMT
Moire, SuperClock, AfterDark, and many other programs work by
"leeching" idle events off of the frontmost application. Since the
TCL is extremely MuiltFinder polite, it uses a sleep time of MAXLONG.
To change the behaviour of the TCL, you should override the
CApplication::Idle() to something like this:
void CMyApp::Idle(EventRecord *macEvent)
{
inherited::Idle(macEvent);
gSleepTime = Min(gSleepTime, MAX_WAIT_TIME);
}
where MAX_WAIT_TIME is set to whatever value seems to work best. Try
using 200 or so, and work from there.
-phil
----
Phil Shapiro Technical Support Analyst
Language Products Group Symantec Corporation
Internet: phils@chaos.cs.brandeis.edu
Path: ucivax!gateway
From: ECO861771@ecostat.aau.dk
Subject: A problem, and debugger limitations
Message-ID: <A1A0A9E4DD9F007ABC@vms2.uni-c.dk>
Newsgroups: fa.think-c
X-Vms-To: IN::"think-c@ics.uci.edu"
Lines: 78
Date: 20 Mar 91 16:12:41 GMT
X-Envelope-To: think-c@ics.uci.edu
I have some problems with a program, and I think it is the following
function that causes the problems.
The function should remove all resources of type theType from oldResFile,
and replace them with all the resources of the theType from newResFile, which
is read only.
My problem is that it often works, and sometimes I get multiple identical
resources with the same ID created in the same file, even though there is
only one copy in newResFile.
I tried to add a breakpoint at BKPT, and it shows that it is adding just
the resources as it should, so I suspect that the error is caused by some
some handle/memory being moved around. If there is anybody who can help
help me, then I would be glad. It really irritates me that it sometimes
works.
BTW: Is there any good method to debug THINK C projects that do a lot of
work on their own and other resource files ? I really hate the way it works
now. The program being debugged is type PROJ creator KAHL and not APPL/SIGN.
And I spoiled my resource file the first time, and I have to copy a clean
copy each time I want to try running it for debugging again. I am also not
sure if Get1IndResource works correctly. Does it search the resource file or
the project file ? I guess we need a standalone debugger to open anapplication
and the source code. This would surely be better here.
thanks,
Povl H. Pedersen
eco861771@ecostat.aau.dk
--- code follows ---
MyMoveResources( theType, oldResFile, newResFile )
ResType theType;
int oldResFile, newResFile;
{
register int i, NumTypes;
Handle resTmp;
ResType myType;
int Itype;
Str255 myStr;
/* Remove all old ICON from file */ /* This Works */
UseResFile( oldResFile );
NumTypes = Count1Resources( theType );
for (i=1; i<=NumTypes; i++)
{
resTmp = Get1IndResource(theType, i);
RmveResource( resTmp );
DisposHandle( resTmp );
}
/* The next part does NOT ALWAYS work, it sometimes creates too
many identical copies of one resource. */
UseResFile( newResFile ); /* read from new */
NumTypes = Count1Resources( theType );
for (i=1; i<=NumTypes; i++)
{
UseResFile( newResFile ); /* read from new */
resTmp = Get1IndResource(theType, i);
HLock( resTmp );
GetResInfo( resTmp, &Itype, &myType, myStr );
DetachResource( resTmp ); /* do not use */
UseResFile( oldResFile ); /* write to old */
BKPT
AddResource( resTmp, myType, Itype, myStr );
UpdateResFile( oldResFile );
HUnlock( resTmp );
ReleaseResource( resTmp );/*delete in map and free*/
}
}
Path: ucivax!gateway
From: siegel@world.std.COM (Rich Siegel)
Subject: Re: A problem, and debugger limitations
Message-ID: <9103210027.AA11558@world.std.com>
Newsgroups: fa.think-c
Lines: 7
Date: 21 Mar 91 00:30:53 GMT
When your program runs, the .Rsrc file is at the top of the map
chain, and is CurResFile(), so all of the Get1xxxResource calls will
behave correctly with your program, unless you're trying to muck with
your own application's code resources.
R.
Path: ucivax!gateway
From: bootsie!olson@ICS.UCI.EDU ("Eric K. Olson")
Subject: Re: A problem, and debugger limitations
Message-ID: <9103210039.AA08273@bootsie.UUCP>
In-Reply-To: vax.ftp.com!ECO861771@ecostat.aau.dk's message of Wed 20-Mar-91 4:12pm.
X-Mailer: Mail User's Shell (6.4 2/14/89)
Newsgroups: fa.think-c
Reply-To: olson@endor.harvard.edu
Lines: 110
Date: 21 Mar 91 00:41:24 GMT
In a message of Mar 20, 4:12pm, it is written:
> [...]
> The function should remove all resources of type theType from oldResFile,
> and replace them with all the resources of the theType from newResFile, which
> is read only.
>
> My problem is that it often works, and sometimes I get multiple identical
> resources with the same ID created in the same file, even though there is
> only one copy in newResFile.
>
> BTW: Is there any good method to debug THINK C projects that do a lot of
> work on their own and other resource files ? I really hate the way it works
> now. The program being debugged is type PROJ creator KAHL and not APPL/SIGN.
The project file is of this type. You shouldn't be manipulating
resources in the project file, however. You should modify resources in
your project's .rsrc file (this file can be of any type or creator,
usually a ResEdit document). This file is CurResFile() when starting up
under the editor. The application will be CurResFile() when starting
up, after being built. Just save this refNum in a global and you will
always have the application's (or the .rsrc file's) resource file refNum.
> And I spoiled my resource file the first time, and I have to copy a clean
> copy each time I want to try running it for debugging again.
This can still happen. Having multiple resources with idential types and
IDs is a serious offender when it comes to spoiling resource files.
> I am also not
> sure if Get1IndResource works correctly. Does it search the resource file or
> the project file ?
It searches only the _current_ CurResFile. I like to save and restore
the CurResFile around Resource Manager Calls.
The Macintosh Print Manager sometimes sets the CurResFile to the most
recently opened file, on exit from its routines (this is often correct,
but not always). This can really cause trouble if you assume that
UseResFile(appRefNum) is permanent, and you have another (more recently
opened) resource file.
I suspect you are getting double resources because the remove is
failing, not the add. Check its return code with ResError(). This can
be caused by the resProtected bit being set, or if the HomeResFile() of
the resource is not the CurResFile().
It _might_ also occur if the resource is currently loaded into memory
and HNoPurged(). I can't remember if I found a bug in Get1Resource()
that returns any already loaded resource with the same type and ID (from
any file) instead of the resource in the CurResFile(). Perhaps you can
check this out. If that bug does exist, the RmveResource() would fail
because the resource's HomeResFile() would be the CurResFile.
It's not very easy dealing with multiple resource files.
> MyMoveResources( theType, oldResFile, newResFile )
> ResType theType;
> int oldResFile, newResFile;
> {
> register int i, NumTypes;
> Handle resTmp;
> ResType myType;
> int Itype;
> Str255 myStr;
>
> /* Remove all old ICON from file */ /* This Works */
> UseResFile( oldResFile );
> NumTypes = Count1Resources( theType );
>
> for (i=1; i<=NumTypes; i++)
> {
> resTmp = Get1IndResource(theType, i);
> RmveResource( resTmp );
I think the above call fails when the resource's "double up".
> DisposHandle( resTmp );
> }
>
> /* The next part does NOT ALWAYS work, it sometimes creates too
> many identical copies of one resource. */
>
> UseResFile( newResFile ); /* read from new */
> NumTypes = Count1Resources( theType );
>
> for (i=1; i<=NumTypes; i++)
> {
> UseResFile( newResFile ); /* read from new */
> resTmp = Get1IndResource(theType, i);
> HLock( resTmp );
> GetResInfo( resTmp, &Itype, &myType, myStr );
> DetachResource( resTmp ); /* do not use */
> UseResFile( oldResFile ); /* write to old */
> BKPT
> AddResource( resTmp, myType, Itype, myStr );
> UpdateResFile( oldResFile );
> HUnlock( resTmp );
> ReleaseResource( resTmp );/*delete in map and free*/
>
> }
>
> }
>
--
Eric K. Olson, Editor, Prepare() NOTE: olson@bootsie.uucp doesn't work
Lexington Software Design Internet: olson@endor.harvard.edu
72A Lowell St., Lexington, MA 02173 Uucp: harvard!endor!olson
(617) 863-9624 Bitnet: OLSON@HARVARD
Path: ucivax!gateway
From: mkelly@cs.uoregon.edu
Subject: _SwapMMUMode doesn't work
Message-ID: <9103210252.AA25842@obelix.cs.uoregon.edu.cs.uoregon.edu>
Newsgroups: fa.think-c
Lines: 28
Date: 21 Mar 91 02:55:22 GMT
Help! When I step through the following code:
short mode, mode2;
mode = true32b;
mode2 = GetMMUMode();
SwapMMUMode( &mode );
mode2 = GetMMUMode();
mode2 == 0 before the call to SwapMMUMode (and mode == 1); after the call,
mode is still == 1, and after the 2nd call to GetMMUMode, mode2 is still == 0.
What is going on here?
(I have the Profiler, 68020, and MacHeaders options set, and the MF Attrs ==
0080 : 32-bit compatible).
Thanks,
Mike.
_____________________________________________________________________________
Michael A. Kelly America Online: Michael792
mkelly@cs.uoregon.edu Compu$erve: 73567,1651
_____________________________________________________________________________
"I know not with what weapons World War III will be fought, but World War
IV will be fought with sticks and stones."
- Albert Einstein
Newsgroups: fa.think-c
Path: ucivax!jhummel
From: jhummel@ics.uci.edu (Joseph Edward Hummel)
Subject: Help with malloc -- fails for large n?
Message-ID: <27E88FE3.7394@ics.uci.edu>
Sender: jhummel@ics.uci.edu (Joseph Edward Hummel)
Organization: UC Irvine Department of ICS
Distribution: usa
Date: Thu, 21 Mar 1991 10:50:11 GMT
Lines: 17
Maybe someone out there can explain the following. I'm running Think C
version 4.0.2, and if I do the following, it works:
p = malloc(16000 * sizeof(int));
But if I change the 16000 to 17000, it fails -- p is set to NULL after
the call. 17000 * sizeof(int) isn't that big, what's the deal? Does malloc
behave strangely under certain circumstances? My program is one big main,
could that be it?
Thanks in advance.
- joe
--
Joe Hummel
ICS Graduate Student, UC Irvine
Internet: jhummel@ics.uci.edu
Path: ucivax!gateway
From: dak@sq.COM
Subject: Re: Help with malloc -- fails for large n?
Message-ID: <m0jJS8L-00014PC@sq.sq.com>
In-reply-to: Your message of "Thu, 21 Mar 91 10:50:11 GMT."
<27E88FE3.7394@ics.uci.edu>
Newsgroups: fa.think-c
Lines: 31
Date: 21 Mar 91 16:05:17 GMT
> Maybe someone out there can explain the following. I'm running Think C
> version 4.0.2, and if I do the following, it works:
>
> p = malloc(16000 * sizeof(int));
>
> But if I change the 16000 to 17000, it fails -- p is set to NULL after
> the call. 17000 * sizeof(int) isn't that big, what's the deal? Does malloc
> behave strangely under certain circumstances? My program is one big main,
> could that be it?
One oddity in the ThinkC compiler is that sizeof() is an int, not a size_t.
(User's manual, 7.4.8)
So you are getting integer arithmetic for your computation...which overflows
to a negative number (16000 * 2 == 32000, 17000 * 2 == 34000, which is greater
than 32767, and therefore won't fit in an int).
Try 17000L * sizeof(int), that should work.
By the way, how do other folks solve the "sizeof isn't a size_t" oddity?
I've been casting the result to size_t in code that I've been porting, but...
I was hoping for a better way.
Regards,
Dak
--
David A. 'Dak' Keldsen of SoftQuad, Inc. email: dak@sq.com phone: 416-963-8337
"...Then anyone who leaves behind him a written manual, and likewise
anyone who receives it, in the belief that such writing will be clear
and certain, must be exceedingly simple-minded..." -- Plato, _Phaedrus_
Path: ucivax!gateway
From: bin@primate.wisc.edu (Brain in Neutral)
Subject: Re: A problem, and debugger limitations
Message-ID: <9103211603.AA06060@rhesus.primate.wisc.edu>
Newsgroups: fa.think-c
Lines: 5
Date: 21 Mar 91 16:05:29 GMT
One of the problems with removing resources is that it's best to remove
them in a loop that counts DOWN, not up.
Paul DuBois
dubois@primate.wisc.edu
Path: ucivax!gateway
From: srauseo@128.38.16.7
Subject: Getting a PixMap
Message-ID: <34.srauseo@128.38.16.7>
Newsgroups: fa.think-c
Reply-To: srauseo@nswc-wo.navy.MIL
Lines: 42
Date: 21 Mar 91 16:32:30 GMT
I have two video cards, one of them a RasterOps ColorBoard 364, which in
addition to being a 24-bit color card, also will grab a video frame to the card.
I want to be able to get to the PixMap of that screen, but I am having a bit of
trouble.
So far, I have been able to select the correct card and get the handle to the
GDevice, and thus the handle to the PixMap associated with that device.
Here is where my troubles begin.
First, I have the Inside Macintosh series, but not the documentation for 32-bit
Quickdraw. The Inside Mac does not describe any more than one pixelType for a
PixMap (that is Chunky, pixelType=1). The pixelType on this device is 16. What
does that correspond to?
Second, I have a question concerning 32-bit addresses. The baseAddress of the
PixMap for the 364 board is shown by the THINK-C debugger to be 0x000000, even
though as a long int it is 0xFA000000. (The same for the main screen--the address
is listed as 0x000000, but coerced to be a long, it shows up as 0xF9000000.) I
assume that this is just a sign that THINK-C is using 24 bit addressing. I am also
then assuming that 32-bit Qucikdraw will be smart enough to use 32-bit
addressing when I do a CopyBits.
My last questions concerns the color version of CopyBits. Do the PixMaps used
in CopyBits have to be the portPixMap of some cGrafPort? I would like to be able to
copy from the PixMap associated with the screen to some PixMap created in main
memory without having to create any intermediate CGrafPort's, but I don't see how
CopyBits will know it is a PixMapHandle and not a BitMap without the high bits set in
the portVersion variable.
What I would really like to do is get around all of this foolishness and
directly access the bytes in the PixMap data on the card, but the 32-bit addressing
seems to be getting in the way. Any hints or ideas?
I am using THINK-C 4.0.1
****************************************************
* Steven Rauseo (R44) *
* srauseo@nswc-wo.navy.mil [26.1.0.102] *
* Naval Surface Warfare Center *
* Nonliear Dynamics Group *
* Phone (301) 394-4325 *
****************************************************
Path: ucivax!gateway
From: bruce@logic.dsg.ti.COM ("Bruce Florman (BFLM")
Subject: Re: Help with malloc -- fails for large n?
Message-ID: <9103211854.AA16054@logic.dsg.ti.com>
In-Reply-To: <m0jJS8L-00014PC@sq.sq.com>; from "dak@sq.COM" at Mar 21, 91 4:05 pm
X-Mailer: ELM [version 2.3 PL3]
Newsgroups: fa.think-c
Lines: 11
Date: 21 Mar 91 20:05:21 GMT
> By the way, how do other folks solve the "sizeof isn't a size_t" oddity?
> I've been casting the result to size_t in code that I've been porting, but...
> I was hoping for a better way.
How does everyone feel about this:
#define SIZEOF(T) ((size_t)sizeof(T))
It's a bit ugly, but it is portable.
--Bruce Florman
Path: ucivax!gateway
From: bruce@logic.dsg.ti.COM ("Bruce Florman (BFLM")
Subject: Re: Help with malloc -- fails for large n?
Message-ID: <9103211814.AA15369@logic.dsg.ti.com>
In-Reply-To: <27E88FE3.7394@ics.uci.edu>; from "Joseph Edward Hummel" at Mar 21, 91 10:50 am
X-Mailer: ELM [version 2.3 PL3]
Newsgroups: fa.think-c
Lines: 27
Date: 21 Mar 91 20:10:42 GMT
>
> Maybe someone out there can explain the following. I'm running Think C
> version 4.0.2, and if I do the following, it works:
>
> p = malloc(16000 * sizeof(int));
>
> But if I change the 16000 to 17000, it fails -- p is set to NULL after
> the call. 17000 * sizeof(int) isn't that big, what's the deal? Does malloc
> behave strangely under certain circumstances? My program is one big main,
> could that be it?
Try changing it to 17000L * sizeof(int) and I'll bet it will work. Since
THINK C's sizeof operator returns an int rather than a size_t (this is a
mis-feature IMHO) and since 17000 is in the range of int for THINK C, the
compiler evaluates this as an int expression. However, 17000 * sizeof(int)
is 34000 (0x84d0) in THINK C, which is beyond the range of int (the high
bit is set, so the quantity looks negative). I assume that you've included
stdlib.h, so the compiler knows that malloc takes a 4 byte argument (size_t),
so it sign extends 0x84d0 to 0xffff84d0, which as an unsigned quantity is a
little over 4 gigabytes. Since malloc can't allocate that much memory on any
current Macs, it returns NULL.
By changing the expression to 17000L * sizeof(int), or alternatively
17000 * (size_t)sizeof(int), you will cause the compiler to recognize that
the expression result requires 4 bytes.
--Bruce Florman
Newsgroups: fa.think-c
Path: ucivax!jhummel
From: jhummel@ics.uci.edu (Joseph Edward Hummel)
Subject: Help with malloc...
Message-ID: <27E915B4.12063@ics.uci.edu>
Sender: jhummel@ics.uci.edu (Joseph Edward Hummel)
Organization: UC Irvine Department of ICS
Distribution: usa
Date: Thu, 21 Mar 1991 20:21:08 GMT
Lines: 29
Wow, thanks for all the responses to my plea for help with malloc. The
problem was this:
p = malloc(16000 * sizeof(int));
worked, but
p = malloc(17000 * sizeof(int));
didn't. The problem turns out to be that since ints are 2 bytes in Think C,
the 17000 x 2 becomes negative (since 34000 sets the sign bit in a 2-byte int),
and then this value is cast into a negative long which is then passed to
malloc. Malloc then promptly chokes.
The solution is to cast either of the two operands into a long: e.g.
p = malloc(17000L * sizeof(int));
I think what I'll do is create a sizeof macro for use with malloc that
casts its result into a long (or more correctly, to a value of type
size_t).
Thanks to all who replied!
- joe
--
Joe Hummel
ICS Graduate Student, UC Irvine
Internet: jhummel@ics.uci.edu
Path: ucivax!gateway
From: ephraim@think.COM
Subject: Re: Help with malloc -- fails for large n?
Message-ID: <9103211422.AA06845@leander.think.com>
In-Reply-To: Your message of "Thu, 21 Mar 91 10:50:11 GMT."
<27E88FE3.7394@ics.uci.edu>
Newsgroups: fa.think-c
Lines: 17
Date: 21 Mar 91 20:27:12 GMT
From: Joseph Edward Hummel <jhummel@ICS.UCI.EDU>
Date: Thu, 21 Mar 1991 10:50:11 GMT
Maybe someone out there can explain the following. I'm running Think
C version 4.0.2, and if I do the following, it works:
p = malloc(16000 * sizeof(int));
But if I change the 16000 to 17000, it fails -- p is set to NULL after
the call. 17000 * sizeof(int) isn't that big, what's the deal?
The deal is that 17000*sizeof(int) isn't representable as an int, so
it gets truncated. Try (size_t)17000*sizeof(int). Since size_t is
long in Think C, you'll get better results. The brain damage here is
that typeof(sizeof()) should be size_t, not int.
Path: ucivax!gateway
From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
Subject: THINK C header & lib for HyperCard 2.0 XCMDs
Message-ID: <9103212126.AA29935@chaos.cs.brandeis.edu>
Newsgroups: fa.think-c
Lines: 252
Date: 21 Mar 91 21:29:09 GMT
Here's the official conversion of the HyperCard 2.0 header file and
library for THINK C. We've tested it for a while and haven't found
any problems. This release fixes some problems that are present in
the copy presently in your archives, so you will probably want to
replace your copy with this one.
-phil
----
Phil Shapiro Technical Support Analyst
Language Products Group Symantec Corporation
Internet: phils@chaos.cs.brandeis.edu
---------------- think-c-hc-20.cpt.hqx ----------------
(This file must be converted with BinHex 4.0)
:'94)58j,)%-J5%-b,M!J5'9KC'9bFbjMF(3!8%&$9%033e3"!*!$,#i!N!6Nr`%
"3TJ!!#ZeD3!!UUUQ!!B!N!P!Q3!!Q'"SHAH*Q)U*"jQD"hCfH'F+KhPkKfLAHTJ
+#!4P9'CPYeC8D999GhHD#`!+N!!!N#B*)!!#-d499PCfPhGQGRGhKjL*KjQ(Q)U
B!+N+N!#U#TS*U8!M49@3!fCfChGfD'GiQ*GiL(L)Q)QCLSL+#3S*#3#UUSS!N!#
!UU!!UU#C#DQBN!#UQR#3!*UDN!#S#T!!#3QJS!#U#U$kmRr[hqr($)!2&SmpmVH
l0ZTi0T!!Ic5ee@9Ae6XKVUVP$A1f"NHD0Y-1l0dmed)f!+jmh9G#Ub'EJ3LB3c6
hqGY@cEI$kU24$LqllZ+(CjlSfAbS!jE[RE%Na`3Kb9e`-UZKE+k9[K+P9$DGS%J
QEj@kid5#ZYP$9'k9-!bQk)'+Se`S89XU60pAR$Nhl`f1DHlIJ#A,$SXSi-SBMfr
hp)BhK04BbGepH2(MqQVAC6,A#(cqHMrIARq"1DqIcar5"5Ub6B,3Ka,Q26'M5(T
A!ZUXSV`TP$le"6JfrMMqQ9P0@YBbqHI`PCIdl,9c&38D'26+c"NB*%fKITPjAjk
DVec"38D'2CI6cL6[Ahl&c0B@D'[E9C62aC-ZU+VQIej#N[KAH)c8L3@6kmBElG$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!%am)XrMRq`GKZi1qqj
J`4J'$jd5*DI2!PI`3k1MU),2M!-&@C',2+!C2393@HDAH3&H1"B*JKQSZJ'$-,)
CYpi!c%6X2@AK!-'$C"Kj3$,05'16L3N,1)G3Ak!)Xm"3a9GImB$"Lm)aer4!B,U
+'f`3'F+4`0rLll*KPJ#3!d%#I9i!!J!,5(P`CA*B3feN,QJ"!*!$#&4&@&4,38K
-Sma3eU3+QQ`"!F*FB!"!#3"LME!*!'#r!,5(P`CA*B6'PL,VN"!!!,q&"56dT
,38K-SmY9$+2-80d"!+RTA$-!!J!!B`i!N!BI[3#3"&!i!!!:
Path: ucivax!gateway
From: mkelly@cs.uoregon.edu
Subject: Re: Getting a PixMap
Message-ID: <9103212305.AA27770@obelix.cs.uoregon.edu.cs.uoregon.edu>
Newsgroups: fa.think-c
Lines: 57
Date: 21 Mar 91 23:08:59 GMT
>Quickdraw. The Inside Mac does not describe any more than one pixelType for a
>PixMap (that is Chunky, pixelType=1). The pixelType on this device is 16. Wh
>at
>does that correspond to?
>
According to 'Designing Cards and Drivers for the Macintosh Family' page 130,
the pixelType for a direct device is ChunkyDirect == 16.
>Second, I have a question concerning 32-bit addresses. The baseAddress of the
>PixMap for the 364 board is shown by the THINK-C debugger to be 0x000000, even
>though as a long int it is 0xFA000000. (The same for the main screen--the add
>ress
>is listed as 0x000000, but coerced to be a long, it shows up as 0xF9000000.)
>I
>assume that this is just a sign that THINK-C is using 24 bit addressing. I am
> also
>then assuming that 32-bit Qucikdraw will be smart enough to use 32-bit
>addressing when I do a CopyBits.
>
I am having exactly the same problems with 32bqd installed, Think C 4.0.2.
As I said before, if you get any useful replies to the question of how to
write directly to the PixMap, please forward them to me.
>My last questions concerns the color version of CopyBits. Do the PixMaps used
>in CopyBits have to be the portPixMap of some cGrafPort? I would like to be a
>ble to
>copy from the PixMap associated with the screen to some PixMap created in main
>memory without having to create any intermediate CGrafPort's, but I don't see
>how
>CopyBits will know it is a PixMapHandle and not a BitMap without the high bits
> set in
>the portVersion variable.
>
It works fine for me - just remember to lock the PixMap before you try to
CopyBits from or draw to it. CopyBits copies from a BitMap to a BitMap -
whether the BitMaps are associated with GrafPorts or not is irrelevant. The
same goes for PixMaps.
>What I would really like to do is get around all of this foolishness and
>directly access the bytes in the PixMap data on the card, but the 32-bit addre
>ssing
>seems to be getting in the way. Any hints or ideas?
>
Me too, but I can't get SwapMMUMode to work.
Mike.
_____________________________________________________________________________
Michael A. Kelly America Online: Michael792
mkelly@cs.uoregon.edu Compu$erve: 73567,1651
_____________________________________________________________________________
"The proof is left as an exercise for the reader."
Path: ucivax!gateway
From: mkelly@cs.uoregon.edu
Subject: Re: _SwapMMUMode doesn't work
Message-ID: <9103220047.AA28433@obelix.cs.uoregon.edu.cs.uoregon.edu>
Newsgroups: fa.think-c
Lines: 65
Date: 22 Mar 91 00:52:51 GMT
This is from Juri Munkki:
I found out what is wrong with the whole thing. I did some work with TMON
and I came up with the following information:
Think C has incorrect glue for GetMMUMode. Actually the glue code is quite
much ok, but the call parameters are defined wrong. The glue code expects
a var parameter just as is defined in IM-V-592, but the compiler doesn't
allow this.
The glue code for SwapMMUMode wants a char var parameter.
So, you can't use GetMMUMode to get the mode, but then again you do not
need to, since it is given to you by SwapMMUMode. Here's the shortest
application that works and at the same time documents that it works:
void main()
{
char mode1,mode2;
mode1=true32b;
SwapMMUMode(&mode1);
mode2=mode1;
SwapMMUMode(&mode2);
Debugger();
}
At the Debugger() line, mode1==0 and mode2==1. This is as it should be.
Happy hacking. I'm going to bed.
____________________________________________________________________________
/ Juri Munkki / Helsinki University of Technology / Wind / Project /
/ jmunkki@hut.fi / Computing Center Macintosh Support / Surf / STORM /
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
P.S. You might want to report this to the Think C list. I'm too tired.
I managed to get my code working before I received the above message from
Juri. Here is what I've got:
short mode;
if ( QD32Installed() ) {
SwapMMUMode( &mode );
Debugger();
}
When MacsBug is invoked with 'Debugger()', it says I'm in 32-bit mode. Yay!
BTW, if the above code is run with the Think Debugger running in the background
it will crash and burn, which is what was happening to me before.
Mike.
_____________________________________________________________________________
Michael A. Kelly America Online: Michael792
mkelly@cs.uoregon.edu Compu$erve: 73567,1651
_____________________________________________________________________________
"That's not a lie, it's a terminological inexactitude."
- Alexander Haig
Path: ucivax!gateway
From: mkelly@cs.uoregon.edu
Subject: Re: _SwapMMUMode doesn't work
Message-ID: <9103220052.AA28502@obelix.cs.uoregon.edu.cs.uoregon.edu>
Newsgroups: fa.think-c
Lines: 19
Date: 22 Mar 91 00:53:19 GMT
A correction to my previous posting - my code should read:
short mode = 0x0101;
if ( QD32Installed() ) {
SwapMMUMode( &mode );
Debugger();
}
Mike.
_____________________________________________________________________________
Michael A. Kelly America Online: Michael792
mkelly@cs.uoregon.edu Compu$erve: 73567,1651
_____________________________________________________________________________
"Television validates existence."
- Calvin
Path: ucivax!gateway
From: tl17+@andrew.cmu.edu (Ta-Chun Lin)
Subject: Traffic watch
Message-ID: <0bwWyOu00WB64Cq2tl@andrew.cmu.edu>
Newsgroups: fa.think-c
Lines: 10
Date: 28 Mar 91 18:04:41 GMT
Hi Everydoby:
Did anybody use "Traffic Watch" before? It is a counter to check every
packet send out and receive to every node in a network system. It turns
AppleTalk off and uses Printer port instead. I do not have idea how it can
be implemented. I use dumpcode to disassembly "Traffic Watch" but I did not
see any useful Toolbox Routines Call. Does anybody have any idea about
how it is done? Any suggestion is appreciated. Thanks in advance.
Shiem-MIn Chen
tl17@andrew.cmu.edu
Path: ucivax!gateway
From: petrus@alex.stacken.kth.se (Lars Petrus)
Subject: New Creator
Message-ID: <9103290942.AAalex.stacken.kth.se11716@alex.stacken.kth.se>
Newsgroups: fa.think-c
Lines: 41
Date: 29 Mar 91 09:49:24 GMT
I need to change the creator and type of my documents. After a full day of
trying to understand the crazy world of the File Manager I thought I had
grasped the nescessary concepts and came up with this simple solution (as
you see, I work in TCL):
Boolean CLogoCorrectorDoc::DoSave(void)
{
OSErr theError;
FInfo *info;
theError = itsFile->Open(fsRdWrPerm);
<save the document>
/* theError=HGetFInfo(itsFile->volNum, itsFile->dirID, itsFile->name, info);
* info->fdType='THIS';
* info->fdCreator='THAT';
* theError=HSetFInfo(itsFile->volNum, itsFile->dirID, itsFile->name, info);
*/
/* wd=macSFReply->vRefNum; set in OpenFile() */
theError=GetFInfo(itsFile->name, wd, info);
info->fdType='THIS';
info->fdCreator='THAT';
theError=SetFInfo(itsFile->name, wd, info);
<do some cleaning up>
}
However, inside GetFInfo() (or in HGetFInfo() if I use the equivalent
commented code) it just dies in a Bus Error. I'm absolutely clueless! If no
one can help me I guess I'll just have to delete the file and recreate it...
"Madness is the first sign of dandruff" | Email: petrus@alex.stacken.kth.se
- Dr Winston O'Boogie | Reality: Lars Petrus, Solna, Sweden
Path: ucivax!gateway
From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
Subject: New Creator
Message-ID: <9103291419.AA02137@chaos.cs.brandeis.edu>
In-Reply-To: Lars Petrus's message of 29 Mar 91 09:49:24 GMT <9103290942.AAalex.stacken.kth.se11716@alex.stacken.kth.se>
Newsgroups: fa.think-c
Lines: 26
Date: 29 Mar 91 14:21:27 GMT
Boolean CLogoCorrectorDoc::DoSave(void)
{
OSErr theError;
FInfo *info;
theError=GetFInfo(itsFile->name, wd, info);
}
However, inside GetFInfo() (or in HGetFInfo() if I use the equivalent
commented code) it just dies in a Bus Error.
You must allocate space for the FInfo record before you use it. The
easiest way to accomplish this is to use stack alloation, ie, to
declare your record locally. Try:
{
FInfo info;
theError = GetFInfo(itsFile->name, wd, &info);
}
-phil
----
Phil Shapiro Technical Support Analyst
Language Products Group Symantec Corporation
Internet: phils@chaos.cs.brandeis.edu
Path: ucivax!gateway
From: minow@ranger.enet.dec.COM (Martin Minow 31-Mar-1991 1031)
Subject: Buglet in TBUtilities.c PositionDialog()
Message-ID: <9103311542.AA23240@enet-gw.pa.dec.com>
Newsgroups: fa.think-c
Lines: 28
Date: 31 Mar 91 15:45:23 GMT
There's a minor bug in the TCL TBUtilities.c PositionDialog that doesn't
correctly position tall dialogs (270 pixels) on small (Mac/SE) screens.
Make the following changes (this is being retyped, so fix any typos, too :-)
...
left = (screenBits.bounds.right - (theRect->right - theRect->left)) / 2;
#if 0 /* Remove the following */
top = (screenBits.bounds.bottom - (theRect->bottom - theRect->top)) / 3;
top = Max(top, GetMBarHeight() + 1);
#else /* Insert the following */
top = (
screenBits.bounds.bottom
- GetMBarHeight()
- 1
- (theRect->bottom - theRect->top)
) / 3;
if (top < 0)
top = 0;
top += (GetMBarHeight() + 1);
#endif
theRect->right += left - theRect->left;
...
Note: the same error (with the same fix) is probably in FindDlogPosition
in the same file.
Martin
minow@ranger.enet.dec.com